package com.zy.cat.controller.mall.v1;

import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.zy.cat.entity.pdd.PddShops;
import com.zy.cat.entity.pdd.PddShopsDetail;
import com.zy.cat.entity.pdd.PddTopShops;
import com.zy.cat.entity.pdd.PddZtConvert;
import com.zy.cat.service.PddShopsService;
import com.zy.cat.common.annotation.CheckDevPermission;
import com.zy.cat.common.annotation.CheckingMD5;
import com.zy.cat.entity.pdd.PddLotteryUrl;
import com.zy.cat.entity.pdd.PddMallConvert;
import com.zy.cat.entity.pdd.PddResourceUrl;
import com.zy.cat.entity.pdd.PddShopConvert;
import com.zy.cat.entity.resp.Pages;
import com.zy.cat.entity.resp.RSPE;
import com.zy.cat.entity.resp.ResultPage;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

/**
 * Link
 * 
 * @info
 * @author Link
 * @date 2020-06-15 09:32
 */
@Api(value = "pdd_shops", tags = { "9趣猫拼多多商城开放API" }, description = "9趣猫拼多多商城开放接")
@RestController
@RequestMapping("/v1/pdd/goods")
@Slf4j
public class PddShopController {
	@Autowired
	PddShopsService pddShopsService;

	@PostMapping("/list")
	@ApiOperation(value = "商品搜索/根据分类获取商品信息", notes = "商品类型(根据商品类型API获取 )", position = 1, response = PddShops.class)
	@ApiImplicitParams({
			@ApiImplicitParam(name = "rtype", value = "应用平台(0.安卓、1.IOS)", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "pid", value = "订单标识（用户的pid）", example = "test", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "optid", value = "标签ID（通过API【/opt/list】获取）0.全部(用于商品搜索)", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "query", value = "搜索关键词", example = "女鞋", dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "sorttype", value = "排序方式:0-综合排序;1-按佣金比率升序;2-按佣金比例降序;3-按价格升序;4-按价格降序;5-按销量升序;6-按销量降序;7-优惠券金额排序升序;8-优惠券金额排序降序;9-券后价升序排序;10-券后价降序排序;11-按照加入多多进宝时间升序;12-按照加入多多进宝时间降序;13-按佣金金额升序排序;14-按佣金金额降序排序;15-店铺描述评分升序;16-店铺描述评分降序;17-店铺物流评分升序;18-店铺物流评分降序;19-店铺服务评分升序;20-店铺服务评分降序;27-描述评分击败同类店铺百分比升序，28-描述评分击败同类店铺百分比降序，29-物流评分击败同类店铺百分比升序，30-物流评分击败同类店铺百分比降序，31-服务评分击败同类店铺百分比升序，32-服务评分击败同类店铺百分比降序", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "withCoupon", value = "是否只返回优惠券的商品(0.返回所有商品、1.只返回有优惠券的商品)", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "uuid", value = "MD5(随机数)", example = "27b8f8538f84fa456f783e600c27dd18", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "token", value = "MD5(rtype_optid_sorttype_optid_uuid_rtype_withCoupon_time)", example = "1001", required = true, dataType = "String", paramType = "form") })
	@CheckingMD5(checkingStr = "rtype_optid_sorttype_optid_uuid_rtype_withCoupon", MD5 = "token")
	public Object list(String pid,Integer rtype, Long optid, String query, Integer sorttype, Integer withCoupon, String uuid,
			String token, Pages pages) {
		if (pages == null || pages.getPageSize() > 100 || pages.getPageSize() < 10) {
			return new RSPE<Object>(-3, "不在分页范围[10~100]");
		}

		Callable<RSPE<ResultPage<PddShops>>> result = new Callable<RSPE<ResultPage<PddShops>>>() {
			@Override
			public RSPE<ResultPage<PddShops>> call() throws Exception {
				if (rtype == null) {
					return new RSPE<ResultPage<PddShops>>(-2, "应用平台参数错误");
				}
				return new RSPE<ResultPage<PddShops>>(1, "success",
						pddShopsService.pddList(pid,rtype, query, sorttype, 0l, optid, withCoupon, pages));
			}
		};
		return result;
	}

	@PostMapping("/opt/list")
	@ApiOperation(value = "获取商品标签信息", notes = "获取商品标签信息", position = 2, response = RSPE.class)
	@ApiImplicitParams({
			@ApiImplicitParam(name = "rtype", value = "应用平台(0.安卓、1.IOS)", example = "0", dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "optid", value = "0.获取固定的首页标签，其他获取标签的子标签", example = "0", dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "uuid", value = "MD5(随机数)", example = "27b8f8538f84fa456f783e600c27dd18", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "token", value = "MD5(rtype_optid_rtype_optid_uuid_rtype_time)", example = "1001", required = true, dataType = "String", paramType = "form") })
	@CheckingMD5(checkingStr = "rtype_optid_rtype_optid_uuid_rtype", MD5 = "token")
	public Object optList(Integer rtype, String uuid, String token, Long optid) {
		if (rtype == null) {
			return new RSPE<List<Map<String, Object>>>(-1, "应用平台参数错误");
		}
		Callable<RSPE<List<Map<String, Object>>>> result = new Callable<RSPE<List<Map<String, Object>>>>() {
			@Override
			public RSPE<List<Map<String, Object>>> call() throws Exception {
				return new RSPE<List<Map<String, Object>>>(1, "success", pddShopsService.pddCatList(rtype, optid));
			}
		};
		return result;
	}

	@PostMapping("/info")
	@ApiOperation(value = "获取商品详细信息", notes = "获取商品详细信息", position = 3, response = PddShopsDetail.class)
	@ApiImplicitParams({
			@ApiImplicitParam(name = "rtype", value = "应用平台(0.安卓、1.IOS)", example = "0", dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "sid", value = "商品ID", example = "0", dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "uuid", value = "MD5(随机数)", example = "27b8f8538f84fa456f783e600c27dd18", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "token", value = "MD5(rtype_sid_rtype_sid_uuid_time)", example = "1001", required = true, dataType = "String", paramType = "form") })
	@CheckingMD5(checkingStr = "rtype_sid_rtype_sid_uuid", MD5 = "token")
	public Object shopInfo(Integer rtype, String uuid, String token, Long sid) {
		Callable<RSPE<PddShopsDetail>> result = new Callable<RSPE<PddShopsDetail>>() {
			@Override
			public RSPE<PddShopsDetail> call() throws Exception {
				if (rtype == null) {
					return new RSPE<PddShopsDetail>(-1, "应用平台参数错误");
				}
				if (sid == null) {
					return new RSPE<PddShopsDetail>(-1, "sid错误");
				}
				return new RSPE<PddShopsDetail>(1, "success", pddShopsService.pddShopInfo(rtype, sid));
			}
		};
		return result;
	}

	@PostMapping("/convert")
	@ApiOperation(value = "商品高佣转链", notes = "商品高佣转链", position = 4, response = PddShopConvert.class)
	@ApiImplicitParams({
			@ApiImplicitParam(name = "rtype", value = "应用平台(0.安卓、1.IOS)", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "pid", value = "订单标识（rtype=1/2.用户的pid,其他待定）", example = "0", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "sid", value = "商品ID", example = "0", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "dtype", value = "订单拼团类型（0.单人购买、1.拼团购买）", example = "0", required = true, dataType = "int", paramType = "form"),
//			@ApiImplicitParam(name = "stype", value = "链接推广类型（10.全部、0.微信推广[生成打开微信客户端的链接]、1.小程序推广[微信内打开拼多多小程序]、2.微博推广链接）", example = "1", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "ctype", value = "APP平台(0.九趣猫、1.淘淘集、2.一陶)", example = "1", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "uuid", value = "MD5(随机数)", example = "27b8f8538f84fa456f783e600c27dd18", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "utoken", value = "登录返回字段", example = "1001", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "token", value = "MD5(rtype_pid_sid_dtype_uuid_rtype_time)", example = "1001", required = true, dataType = "String", paramType = "form") })
	@CheckingMD5(checkingStr = "rtype_pid_sid_dtype_uuid_rtype", MD5 = "token")
	@CheckDevPermission
	public Object shopConvert(@RequestParam(name = "ctype",defaultValue = "0")Integer ctype,Integer rtype, String pid, Long sid, Integer dtype, String uuid, String token,
			String utoken ) {
		if (rtype == null) {
			return new RSPE<PddShopConvert>(-1, "应用平台参数错误");
		}
		if (org.apache.commons.lang3.StringUtils.isBlank(pid)) {
			return new RSPE<PddShopConvert>(-1, "必要参数错误");
		}
		Callable<RSPE<PddShopConvert>> result = new Callable<RSPE<PddShopConvert>>() {
			@Override
			public RSPE<PddShopConvert> call() throws Exception {
				return new RSPE<PddShopConvert>(pddShopsService.pddShopConvert(ctype,rtype, pid, sid, dtype ));
			}
		};
		return result;
	}

	@PostMapping("/zt/convert")
	@ApiOperation(value = "主题推广高佣转链", notes = "主题推广转链", position = 6, response = PddZtConvert.class, responseContainer = "List")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "rtype", value = "应用平台(0.安卓、1.IOS)", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "pid", value = "订单标识（用户的pid）", example = "0", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "tid", value = "主题ID", example = "7555", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "uuid", value = "MD5(随机数)", example = "27b8f8538f84fa456f783e600c27dd18", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "ctype", value = "APP平台(0.九趣猫、1.淘淘集、2.一陶)", example = "1", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "utoken", value = "登录返回字段", example = "1001", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "token", value = "MD5(rtype_pid_uuid_rtype_tid_time)", example = "1001", required = true, dataType = "String", paramType = "form") })
	@CheckingMD5(checkingStr = "rtype_pid_uuid_rtype_tid", MD5 = "token")
	@CheckDevPermission
	public Object ztConvert(@RequestParam(name = "ctype",defaultValue = "0")Integer ctype,Integer rtype, String pid, Long tid, String uuid, String token) {
		if (rtype == null) {
			return new RSPE<List<PddZtConvert>>(-2, "应用平台参数错误");
		}
		if (StringUtils.isBlank(pid)) {
			return new RSPE<List<PddZtConvert>>(-3, "订单标识参数错误");
		}
		if (tid == null || tid < 0) {
			return new RSPE<List<PddZtConvert>>(-4, "主题ID参数错误");
		}
		Callable<RSPE<List<PddZtConvert>>> result = new Callable<RSPE<List<PddZtConvert>>>() {
			@Override
			public RSPE<List<PddZtConvert>> call() throws Exception {
				return new RSPE<List<PddZtConvert>>(pddShopsService.pddZtConvert(ctype,rtype, pid, tid));
			}
		};
		return result;
	}

	@PostMapping("/rank/list")
	@ApiOperation(value = "热销榜单数据", notes = "主题推广转链", position = 7, response = PddTopShops.class, responseContainer = "List")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "rtype", value = "应用平台(0.安卓、1.IOS)", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "pid", value = "订单标识（用户的pid）", example = "test", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "page", value = "分页，默认1", example = "1", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "stype", value = "榜单类型（1-实时热销榜；2-实时收益榜）", example = "1", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "uuid", value = "MD5(随机数)", example = "27b8f8538f84fa456f783e600c27dd18", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "token", value = "MD5(uuid_page_uuid_rtype_stype_time)", example = "1001", required = true, dataType = "String", paramType = "form") })
	@CheckingMD5(checkingStr = "uuid_page_uuid_rtype_stype", MD5 = "token")
	public Object rangList(String pid,Integer rtype, Integer page, Integer stype, String uuid, String token) {
		if (rtype == null) {
			return new RSPE<List<PddTopShops>>(-2, "应用平台参数错误");
		}
		if (stype == null) {
			return new RSPE<List<PddTopShops>>(-3, "榜单类型参数错误");
		}
		if (page == null || page < 1) {
			return new RSPE<List<PddTopShops>>(-4, "分页参数错误");
		}
		Callable<RSPE<List<PddTopShops>>> result = new Callable<RSPE<List<PddTopShops>>>() {
			@Override
			public RSPE<List<PddTopShops>> call() throws Exception {
				return new RSPE<List<PddTopShops>>(pddShopsService.getTopShipList(pid,rtype, page, stype));
			}
		};
		return result;
	}

	@PostMapping("/zpcmd")
	@ApiOperation(value = "获取转盘抽面单Url", notes = "转盘抽免单", position = 8, response = PddLotteryUrl.class, responseContainer = "List")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "rtype", value = "应用平台(0.安卓、1.IOS)", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "pid", value = "订单标识（用户的pid）", example = "test", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "uuid", value = "MD5(随机数)", example = "27b8f8538f84fa456f783e600c27dd18", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "utoken", value = "登录返回字段", example = "1001", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "token", value = "MD5(uuid_pid_uuid_pid_param_time)", example = "17cc1cee47c8e647ff891fbe5adc11d6", required = true, dataType = "String", paramType = "form") })
	@CheckingMD5(checkingStr = "uuid_pid_uuid_pid_param", MD5 = "token")
	@CheckDevPermission
	public Object getLotteryUrl(String pid, String uuid, String token) {
		if (StringUtils.isBlank(pid)) {
			return new RSPE<List<PddLotteryUrl>>(-2, "订单标识参数错误");
		}
		Callable<RSPE<List<PddLotteryUrl>>> result = new Callable<RSPE<List<PddLotteryUrl>>>() {
			@Override
			public RSPE<List<PddLotteryUrl>> call() throws Exception {
				return new RSPE<List<PddLotteryUrl>>(pddShopsService.getPddLotteryUrl(pid));
			}
		};
		return result;
	}

	@PostMapping("/pdurl")
	@ApiOperation(value = "获取频道推广Url", notes = "单个H5商城页面", position = 9, response = PddResourceUrl.class, responseContainer = "List")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "rtype", value = "应用平台(0.安卓、1.IOS)", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "ptype", value = "频道来源：4-限时秒杀,39997-充值中心, 39998-转链type，39999-电器城，39996-百亿补贴", example = "4", dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "pid", value = "订单标识（用户的pid）", example = "test", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "uuid", value = "MD5(随机数)", example = "27b8f8538f84fa456f783e600c27dd18", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "utoken", value = "登录返回字段", example = "1001", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "token", value = "MD5(uuid_rtype_uuid_pid_rtype_time)", example = "17cc1cee47c8e647ff891fbe5adc11d6", required = true, dataType = "String", paramType = "form") })
	@CheckingMD5(checkingStr = "uuid_rtype_uuid_pid_rtype", MD5 = "token")
	@CheckDevPermission
	public Object getPddResourceUrl(Integer rtype, Integer ptype, String pid, String uuid, String token) {
		if (StringUtils.isBlank(pid)) {
			return new RSPE<List<PddLotteryUrl>>(-2, "订单标识参数错误");
		}
		if (ptype == null || (ptype != 4 && ptype != 39996 && ptype != 39997 && ptype != 39998 && ptype != 39999)) {
			return new RSPE<List<PddLotteryUrl>>(-3, "频道来源错误");
		}
		Callable<RSPE<PddResourceUrl>> result = new Callable<RSPE<PddResourceUrl>>() {
			@Override
			public RSPE<PddResourceUrl> call() throws Exception {
				return new RSPE<PddResourceUrl>(pddShopsService.getPddResourceUrl(pid, ptype));
			}
		};
		return result;
	}

	@PostMapping("/mall/convert")
	@ApiOperation(value = "店铺高佣转链", notes = "店铺推广高佣转链", position = 10, response = PddMallConvert.class)
	@ApiImplicitParams({
			@ApiImplicitParam(name = "rtype", value = "应用平台(0.安卓、1.IOS)", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "pid", value = "订单标识（用户的pid）", example = "0", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "mid", value = "店铺ID", example = "7555", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "ctype", value = "APP平台(0.九趣猫、1.淘淘集、2.一陶)", example = "1", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "uuid", value = "MD5(随机数)", example = "27b8f8538f84fa456f783e600c27dd18", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "utoken", value = "登录返回字段", example = "1001", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "token", value = "MD5(mid_rtype_pid_uuid_rtype_mid_time)", example = "1001", required = true, dataType = "String", paramType = "form") })
	@CheckingMD5(checkingStr = "mid_rtype_pid_uuid_rtype_mid", MD5 = "token")
	@CheckDevPermission
	public Object mallConvert(@RequestParam(name = "ctype",defaultValue = "0")Integer ctype,Integer rtype, String pid, Long mid, String uuid, String token) {
		if (rtype == null) {
			return new RSPE<PddMallConvert>(-2, "应用平台参数错误");
		}
		if (StringUtils.isBlank(pid)) {
			return new RSPE<PddMallConvert>(-3, "订单标识参数错误");
		}
		if (mid == null || mid < 100) {
			return new RSPE<PddMallConvert>(-4, "店铺ID参数错误");
		}
		Callable<RSPE<PddMallConvert>> result = new Callable<RSPE<PddMallConvert>>() {
			@Override
			public RSPE<PddMallConvert> call() throws Exception {
				return new RSPE<PddMallConvert>(pddShopsService.getMallConvert(ctype,rtype, pid, mid));
			}
		};
		return result;
	}
	
	@PostMapping("/auth")
	@ApiOperation(value = "拼多多授权备案", notes = "授权备案，用于排除比价商品,未授权code=0,返回授权地址，已授权返回code=1", position = 11, response = Object.class)
	@ApiImplicitParams({
			@ApiImplicitParam(name = "rtype", value = "应用平台(0.微信小程序、1.花生狗APP打包)", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "pid", value = "用户的pid", example = "0", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "ctype", value = "APP平台(0.九趣猫、1.淘淘集、2.一陶)", example = "1", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "uuid", value = "MD5(随机数)", example = "27b8f8538f84fa456f783e600c27dd18", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "token", value = "MD5(rtype_pid_uuid_rtype_time)", example = "1001",required = true, dataType = "String", paramType = "form") })
	@CheckingMD5(checkingStr = "rtype_pid_uuid_rtype", MD5 = "token")
	public Object auth(Integer ctype,Integer rtype, String pid, String uuid,String token) {
		if (rtype == null) {
			return new RSPE<String>(-2, "应用平台参数错误");
		}
		if (StringUtils.isBlank(pid)) {
			return new RSPE<String>(-3, "用户的pid错误");
		}
		if (ctype == null) {
			return new RSPE<String>(-4, "APP平台错误");
		}
		Callable<RSPE<Object>> result = new Callable<RSPE<Object>>() {
			@Override
			public RSPE<Object> call() throws Exception {
				Object aresult=pddShopsService.getPddAuth(ctype,rtype, pid);
				if(aresult==null) {
					return new RSPE<Object>(1,"已授权","");
				}
				return new RSPE<Object>(0,"授权链接",aresult);
			}
		};
		return result;
	}
	
	@PostMapping("/tj")
	@ApiOperation(value = "获取今日推荐商品信息", notes = "获取今日推荐商品信息", position = 3, response = PddShops.class)
	@ApiImplicitParams({
			@ApiImplicitParam(name = "rtype", value = "应用平台(0.安卓、1.IOS)", example = "0", dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "sid", value = "商品ID", example = "0", dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "sorttype", value = "排序方式:0-综合排序;1-按佣金比率升序;2-按佣金比例降序;3-按价格升序;4-按价格降序;5-按销量升序;6-按销量降序;7-优惠券金额排序升序;8-优惠券金额排序降序;9-券后价升序排序;10-券后价降序排序;11-按照加入多多进宝时间升序;12-按照加入多多进宝时间降序;13-按佣金金额升序排序;14-按佣金金额降序排序;15-店铺描述评分升序;16-店铺描述评分降序;17-店铺物流评分升序;18-店铺物流评分降序;19-店铺服务评分升序;20-店铺服务评分降序;27-描述评分击败同类店铺百分比升序，28-描述评分击败同类店铺百分比降序，29-物流评分击败同类店铺百分比升序，30-物流评分击败同类店铺百分比降序，31-服务评分击败同类店铺百分比升序，32-服务评分击败同类店铺百分比降序", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "withCoupon", value = "是否只返回优惠券的商品(0.返回所有商品、1.只返回有优惠券的商品)", example = "0", required = true, dataType = "int", paramType = "form"),
			@ApiImplicitParam(name = "uuid", value = "MD5(随机数)", example = "27b8f8538f84fa456f783e600c27dd18", required = true, dataType = "String", paramType = "form"),
			@ApiImplicitParam(name = "token", value = "MD5(rtype_sid_rtype_sid_uuid_time)", example = "1001", required = true, dataType = "String", paramType = "form") })
	@CheckingMD5(checkingStr = "rtype_sid_rtype_sid_uuid", MD5 = "token")
	public Object shopTj(Integer rtype, String uuid, String token, Long sid,Integer sorttype,Integer withCoupon,Pages pages) {
		Callable<RSPE<ResultPage<PddShops>>> result = new Callable<RSPE<ResultPage<PddShops>>>() {
			@Override
			public RSPE<ResultPage<PddShops>> call() throws Exception {
				if (rtype == null) {
					return new RSPE<ResultPage<PddShops>>(-1, "应用平台参数错误");
				}
				if (sid == null) {
					return new RSPE<ResultPage<PddShops>>(-1, "sid错误");
				}
				return new RSPE<ResultPage<PddShops>>(1, "success", pddShopsService.pddTjShops(rtype, sid,sorttype,withCoupon,pages));
			}
		};
		return result;
	}
	

}
